<?php 
session_start();
include_once '../classeBDD/connectBdd.php';
$sql = sql::connect();
$memePage = $_SERVER["PHP_SELF"];

$message = 'Enter your login and your password';
if (isset($_POST['btnConnexion']) && !empty($_POST['texuser']) && !empty($_POST['txtMotdepasse'])) {
	$user = $_POST['texuser'];
	$pwd = $_POST['txtMotdepasse'];	
        $query = 'SELECT * FROM `utilisateur` WHERE  `mail` = "'.$user .'" AND `mod_passe` = "'.$pwd.'" ;';
        $query = $sql->query($query );
	if ($sql->num_rows($query)==0) {
		$message = '<span class="txtRouge12b">Connexion failed !</span>';
	}
	else {  
           //session_register("user");
             $_SESSION['etat'] ='Deconnexion';
	     $_SESSION['user'] = $user;
           
            echo '<script language="Javascript">
                document.location.replace("./action_annonce.php?param='.$_GET["param"].'");
                </script>';
           
            exit();
	}
}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>AwaClid - DOC Manager</title>
</head>

<body>
<table width="100%" height="759" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="759" align="center" valign="top"><table width="100%" height="751" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="751" align="center" valign="top">
       
          
          <table width="100%" height="565" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td height="565" align="center" valign="top">
                <table width="504" height="440" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="center" valign="middle">
                     <table width="98%" height="121" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="100%" align="center">
                     <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td width="100%" align="center" class="message"><?php echo $message  ?></td>
                          </tr>
                        </table>
                          <table width="50%" border="0" cellpadding="0" cellspacing="0">
                            <form id="form1" name="form1" method="post" action="">
                              <tr>
                                <td width="29%" height="30" align="left" class="subtitle_3">Login</td>
                                <td width="3%">&nbsp;</td>
                                <td width="68%" align="left"><label>
                                  <input name="texuser" type="text" value="" id="txtUtilisateur" />
                                </label></td>
                              </tr>
                              <tr>
                                <td height="30" align="left" class="subtitle_3">Password</td>
                                <td>&nbsp;</td>
                                <td align="left"><label>
                                  <input name="txtMotdepasse" type="password" id="txtMotdepasse" />
                                </label></td>
                              </tr>
                              <tr>
                                <td height="30" align="left" class="token_1">&nbsp;</td>
                                <td>&nbsp;</td>
                                <td align="left"><label>
                                  <input name="btnConnexion" type="submit" id="btnConnexion" value="Connexion" />
                                </label></td>
                        <table width="100%" height="32" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                          <td align="center" class="txt_4g"><a href="./?page_id=Ajouter_user">creer votre compter</a></td>
                        </tr>
                      </table>
                              </tr>
                            </form>
                          </table></td>
                      </tr>
                    </table>
                     </td>
                  </tr>
                </table></td>
            </tr>
          </table>
          </td>
      </tr>
    </table>
       </td>
  </tr>
</table>

<table width="100%" height="32" border="0" cellpadding="0" cellspacing="0" class="bg_menubar">
  <tr>
    <td align="center">Awa Clid -  Doc Manager </td>
  </tr>
</table>
</body>
</html>

